package test;

import java.util.ArrayList;
import java.util.Collections;

public class test1 {
    public static void main(String[] args) {
        ArrayList<String> list = new ArrayList<>();
        Collections.addAll(list,"张三","李四","王五","张三峰","王者荣耀","王德发","刘欢","刘二小");
        list.stream()
                .filter(s -> s.startsWith("王"))//过滤掉除王姓的
                .filter(s -> s.length()==3)
                .forEach(s -> System.out.println(s));
        list.stream()
                .limit(3)
                .skip(1)
                .forEach(s -> System.out.println(s));

    }
}
